
#  先安装 pip install adb-shell

import subprocess
# 执行 adb 命令并获歌输出
def run_adb_command(command):
    try:
        result = subprocess.run(command, capture_output=True, text=True, check=True)
        return result.stdout
    except subprocess.CalledProcessError as e:
        return f"Error:{e}"

# 不例:获取连该的设备列表
# adb_devices_command = ["adb","devices"]
# 如电池电量、内存使用情况等
# adb_devices_command = ["adb","shell","dumpsys","battery"]
# 如电池电量、内存使用情况等
adb_devices_command = ["adb","shell","input","tap","100", "500"]

devices_output = run_adb_command(adb_devices_command)
#打印出连接的设备列表
print(devices_output)



